package logic

import (
	"context"
	"serve/internal/global/model"

	"serve/internal/svc"
	"serve/videoSrv"

	"github.com/zeromicro/go-zero/core/logx"
)

type RootIngLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewRootIngLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RootIngLogic {
	return &RootIngLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *RootIngLogic) RootIng(in *videoSrv.RootIngRequest) (*videoSrv.RootIngResponse, error) {
	// todo: add your logic here and delete this line
	var video model.Video
	if err := model.DB.Where("id = ?", in.Id).Find(&video).Error; err != nil {
		return nil, err
	}
	var ststus string
	switch video.Status {
	case 0:
		{
			ststus = "未审核"
		}
	case 1:
		{
			ststus = "审核中"
		}
	case 2:
		{
			ststus = "审核通过"
		}
	case 3:
		{
			ststus = "驳回"
		}
	default:
		{
			ststus = "无效的状态"
		}
	}
	return &videoSrv.RootIngResponse{
		Status: ststus,
	}, nil
}
